package top.houry.im.server.listener;

import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import lombok.extern.slf4j.Slf4j;

/**
 * @Desc
 * @Author houruiyang
 * @Date 2022/5/20
 **/
@Slf4j
public class ImServerNettyProcessorListener implements ChannelFutureListener {

    private final String msgTip;

    public ImServerNettyProcessorListener(String msgTip) {
        this.msgTip = msgTip;
    }

    @Override
    public void operationComplete(ChannelFuture future) throws Exception {
        if (future.isSuccess()) {
            log.info("[ImServerNettyProcessorListener]-[operationComplete]-[{}]-[success]", msgTip);
        } else{
            log.error("[Exception]-[ImServerNettyProcessorListener]-[operationComplete]-[{}]", msgTip, future.cause());
        }
    }
}
